/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package manager;

import dao.BookDao;
import entity.Book;
import java.util.List;

/**
 *
 * @author daz
 */
public class BookManager {

    private BookDao bookDao;

    public void setBookDao(BookDao bookDao) {
        this.bookDao = bookDao;
    }

    public BookDao getBookDao() {
        return bookDao;
    }

    public List<Book> searchBooks(String key, String option) {
        return bookDao.searchBook(key, option);
    }

    public Book getBooks(String key, String option) {
        List<Book> listBooks = bookDao.searchBook(key, option);
        if (listBooks.isEmpty()) {
            return null;
        }
        return listBooks.get(0);
    }
}
